<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use App\Models\StudentModel;


class TeacherModel extends Authenticatable
{
    use HasApiTokens, HasFactory, Notifiable;


    protected $table = 'teachernum';

    /**
     * 可批量分配的属性。.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'name',
        'phone',
        'password',
        'created_at',
        'updated_at'
    ];

    public function toClass()
    {
        return $this->belongsToMany(ClassModel::class,'teachernum_classnum','teacherid','classid');
    }
}
